package com.ruoyi.web.controller.yn;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.yn.domain.YnRecycler;
import com.ruoyi.yn.domain.YnRecyclingType;
import com.ruoyi.yn.domain.YnRecyclingWeight;
import com.ruoyi.yn.service.IYnRecyclerService;
import com.ruoyi.yn.service.IYnRecyclingTypeService;
import com.ruoyi.yn.service.IYnRecyclingWeightService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Ming
 * @since 2023-04-25 14:31:56
 */
@Api(tags = "小程序系统参数")
@RestController
@RequestMapping("wx/system")
public class WxSystemController {

    @Resource
    private IYnRecyclingTypeService recyclingTypeService;

    @Resource
    private IYnRecyclerService recyclerService;

    @Resource
    private IYnRecyclingWeightService recyclingWeightService;

    @ApiOperation("回收类型列表")
    @GetMapping("recyclingType")
    public R<List<YnRecyclingType>> recyclingType() {
        List<YnRecyclingType> list = recyclingTypeService.list();
        return R.ok(list);
    }

    @ApiOperation("回收重量列表")
    @GetMapping("recyclingWeight")
    public R<List<YnRecyclingWeight>> recyclingWeight() {
        List<YnRecyclingWeight> list = recyclingWeightService.list();
        return R.ok(list);
    }

    @ApiOperation("接单状态下的回收员列表")
    @GetMapping("upRecyclers")
    public R<List<YnRecycler>> upRecyclers() {
        List<YnRecycler> list = recyclerService.lambdaQuery().eq(YnRecycler::getState, "0")
                .eq(YnRecycler::getDisable, "0").list();
        return R.ok(list);
    }


}
